package com.ysd.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ysd.dao.Impl.ChanPinXiLieDaoImpl;
import com.ysd.dao.Impl.ProductCatalogueDaoImpl;
import com.ysd.dao.Impl.XiangQingDaoImpl;
import com.ysd.entity.ProductCatalogue;
import com.ysd.entity.Products;

public class ProductDetailServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//调用产品系列实现类
		//产品分类
		ProductCatalogueDaoImpl pDao=new ProductCatalogueDaoImpl();
		List<ProductCatalogue> pclist=pDao.getPCList();
		request.setAttribute("pclist", pclist);
		
		//调用产品详情的实现类
		//利用id查询产品信息接收前台传来的内容
		int cId=Integer.parseInt(request.getParameter("productId"));
		XiangQingDaoImpl xDao=new XiangQingDaoImpl();
		List<Products> XiangQingList=xDao.getXiangQingList(cId);
		request.setAttribute("XiangQingList", XiangQingList);
		
		
		
		request.getRequestDispatcher("productdetails.jsp").forward(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
